import axios from 'axios'


export const ZiJinZhiChuJiHuaBaoCun = class ZiJinZhiChuJiHuaBaoCun {
    static ziJinZhiChuJiHuaBaoCun = null
    requestUrl = 'http://localhost/expendFundPlan'

    static getInstance() {
        if (this.ziJinZhiChuJiHuaBaoCun == null) {
            this.ziJinZhiChuJiHuaBaoCun = new ZiJinZhiChuJiHuaBaoCun()
        }
        return this.ziJinZhiChuJiHuaBaoCun
    }

    /**params
     * 查询资金支出计划的方法
     * @param params
     *
     */
    getPageList(params) {
        return axios.get(`${this.requestUrl}/page`, {
            params
        })
    }



    /**
     * 保存的方法
     * @param expendFundPlanjbxx
     * @param expendFundPlanmx
     */
    save(expendFundPlanjbxx, expendFundPlanmx) {
        const params = {
          expendFundPlanjbxx,
           expendFundPlanmx
        }
        console.log(params)
        return axios.post(this.requestUrl, params)
    }

    /**
     * 获取最大计划编号的方法
     */
    getMaxCode() {
        return axios.get(`${this.requestUrl}/code`)
    }

    /**
     * 根据计划编号查询
     * @param planId
     */
    getById(planId) {
        return axios.get(`${this.requestUrl}/${planId}`)
    }

    /**
     *
     * @param id
     * @returns {Promise<AxiosResponse<any>>}
     * 资金计划列表删除
     */
    delete(id) {
        return axios.delete(`${this.requestUrl}/${id}`)
    }


}